FROM debian:unstable-slim
MAINTAINER amjacks
COPY ["./DMInstall.bin", "./docker-entrypoint.sh", "./"]
# 1. 赋予权限 2. 安装 3. 清理安装包
RUN chmod 755 ./DMInstall.bin ./docker-entrypoint.sh \
	&& (echo "c\nn\ny\n21\n4\n1\n\ny\ny" && cat) | ./DMInstall.bin -i \
	&& rm -rf ./DMInstall.bin
# 1. 配置实例 2. 注册服务 3. 清理垃圾 4. 赋权 5. 移动
WORKDIR /opt/dmdbms/bin
RUN ./dminit path=/dmdbms PAGE_SIZE=32 EXTENT_SIZE=32 CASE_SENSITIVE=n CHARSET=1 DB_NAME=DAMENG INSTANCE_NAME=DBSERVER PORT_NUM=5236 \
	&& cd /opt/dmdbms/script/root && ./dm_service_installer.sh -t dmserver -p DMSERVER -i /dmdbms/DAMENG/dm.ini \
	&& cd /opt/dmdbms && rm -rf desktop/ include/ jar/ jdk/ license_en.txt license_zh.txt samples/ uninstall uninstall.sh script/ \
	&& rm -rf /var/lib/apt/lists/* rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin \
	&& chmod -R 777 /dmdbms \
	&& mv /dmdbms /opt/dmdbms/data
# 1. 安装依赖
RUN apt-get update && apt-get -y install procps
# 数据卷
VOLUME ["/dmdbms"]
# 脚本
ENTRYPOINT ["/docker-entrypoint.sh"]
# 导出端口
EXPOSE 5236/tcp
